Skip to content

[#11880] fix(clickhouse): preserve SETTINGS clause on table round-trip#11885

Open
jiangxt2 wants to merge 1 commit into
apache:mainfrom
jiangxt2:fix/clickhouse-settings-roundtrip
Open

[#11880] fix(clickhouse): preserve SETTINGS clause on table round-trip#11885
jiangxt2 wants to merge 1 commit into
apache:mainfrom
jiangxt2:fix/clickhouse-settings-roundtrip

Conversation

@jiangxt2

@jiangxt2 jiangxt2 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Fix SETTINGS clause lost on table round-trip in the ClickHouse catalog.

The write path (appendTableProperties) correctly generates SETTINGS key = value from
table properties with settings. prefix, but the read path never parsed SETTINGS back into
table properties. This caused SETTINGS to be silently dropped on round-trip.

Changes:

  • Added SETTINGS_PATTERN regex to extract the SETTINGS clause from SHOW CREATE TABLE output
  • Extended ShowCreateTableMetadata with a settings field
  • parseCreateStatement() now parses SETTINGS content (in addition to existing ORDER BY / PARTITION BY parsing)
  • load() merges parsed SETTINGS into table properties with settings. prefix

Why are the changes needed?

Fix: #11880

Tables with custom SETTINGS (e.g. index_granularity = 4096) lost those settings when loaded
through Gravitino, because the read path only extracted COMMENT, ENGINE, and cluster metadata
from system.tables.

Does this PR introduce any user-facing change?

Yes. Table properties now include settings.* keys for tables with custom SETTINGS, enabling
correct round-trip of ClickHouse table settings.

How was this patch tested?

  • New test testParseSettingsFromCreateSql in TestClickHouseTableOperations (4 test cases: empty,
    single, multiple settings, settings with COMMENT). Note: this class has @Tag("gravitino-docker-test")
    at class level, so the test runs under -PskipDockerTests=false (not -PskipITs), though the
    test logic itself is pure string parsing with no container dependency.
  • Docker integration tests: ./gradlew :catalogs-contrib:catalog-jdbc-clickhouse:test -PskipDockerTests=false --tests "TestClickHouseTableOperations"

…nd-trip

- Add SETTINGS_PATTERN regex to parse SETTINGS from SHOW CREATE TABLE output
- Add settings field to ShowCreateTableMetadata inner class
- Parse SETTINGS key=value pairs with settings. prefix in parseSettingsClause()
- Merge parsed settings into table properties in load() path

Signed-off-by: jiangxt2 <jiangxt2@vip.qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug report] ClickHouse catalog: SETTINGS clause lost on table round-trip

1 participant